package cn.com.qingz.modules.user.model;

import java.io.Serializable;

import cn.com.qingz.core.model.LockedBean;

/**
 * 权限资源 (可以是 菜单 按钮 URL地址)
 * @author jiulong.hu
 */
public class Resource extends LockedBean implements Serializable {
    private static final long serialVersionUID = 3329105068050341393L;

    private Long id;

    private String permission; //权限标识  程序中判断使用,如"user:create" 唯一

    private String name; //权限描述,UI界面显示使用

    private String type = "menu"; //资源类型 button  menu

    private String url; //定位资源的URL(可选)

    private String groupName; // 权限组名

    public Resource() {}

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Resource other = (Resource) obj;
        if (id == null) {
            if (other.id != null)
                return false;
        } else if (!id.equals(other.id))
            return false;
        return true;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

}
